<template>
  <div class="container">
     <h2>{{name}}</h2>
     <ul>
         <li v-for="item in list" @click='goSelect(item.carSetId)'>{{item.chnName}}</li>
     </ul>
  </div>
</template>

<script>
import { InfiniteScroll,Spinner } from 'mint-ui';
import { mapGetters } from 'vuex'

import getPy from '../../assets/js/sortByPy';
  // Vue.use(InfiniteScroll);
export default {
  
  name: 'selectCar',
  // 数据
  data () {
    return {
      name: '', // 品牌名称
      list: []
    }
  },
    computed:{
    ...mapGetters([
      'getIp',//双胜IP
      'getJumpIp',
      'getIsLocation',//取store中是否已经手动选择城市
      'getCityName',//取store中的城市名
      'getLgnLat',// 取坐标
      'getCarId',//取默认车辆id
      'getDefaultCatAllInfo',//取默认车辆所有信息
      'getPartsOfChoose',//store中的已选车身部位
      'getPartsOfChooseW'//store中的已选车轮部位
    ]),
  },
  // 创建
  created () {
    // 获取车品牌
     this.$http.get(this.$store.state.ip + '/CARNT/CarBaseAction/carBrandById.action?carBrandId=' + this.$route.query.carBrandId)
     .then(res => {
        this.name = res.body.carBrandName
     }).catch(err => {
        console.log(err)
     })
     // 获取车型列表
     this.$http.get(this.$store.state.ip + '/CARNT/CarBaseAction/carSetList.action?carBrandId=' + this.$route.query.carBrandId)
     .then(res => {
        // this.name = res.body.carBrandName
        console.log(res.body)
        this.list = res.body
     }).catch(err => {
        console.log(err)
     })
  },
  // 渲染
  mounted () {
  },
  // 销毁前
  beforeDestory () {

  },
  // 计算
  computed: {

  },
  // 方法
  methods: {
    goSelect(id) {
        this.$router.push('selectSeries?carBrandId=' + this.$route.query.carBrandId + '&carSetId=' + id)
    }
  },
  // 子组件
  components: {

  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">

  .container {
    background:#ffffff;
    height:100%;
        h2{
            background-color: #EFEFEF;
            margin: 0px;
            padding: 5px 10px;
            font-size: .4rem;
        }
        ul {
            background:#ffffff;
            li{
                height:.7rem;
                line-height: .7rem;
                font-size: .36rem;
                border-bottom: 1px solid #EFEFEF;
                padding-left: .2rem;
            }
        }
  }
</style>
